package com.example.androidtraining_ahut2020;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class ProjectDatabaseHelper extends SQLiteOpenHelper {
    //带全部参数的构造函数，此构造函数必不可少
    public ProjectDatabaseHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        //创建数据库sql语句并执行
        String sql = "create table tb2(numbers varchar(20),solution varchar(50))";
        Log.i("DB", "数据表创建成功");
        db.execSQL(sql);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    }
}